package com.todo.event.activity.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/1/7 13:49
 * @description
 */
@Getter
@AllArgsConstructor
public enum SelectOperateEnum {

    GT(1, ">", "大于"),
    LT(2, "<", "小于"),
    GTOE(3, ">=", "大于等于"),
    LTOE(4, "<=", "小于等于"),
    EQ(5, "==", "等于"),
    NEQ(6, "!=", "不等于"),
    IN(7, "inList", "包含"),
    NOT_IN(8, "notinList", "不包含"),
    ;


    private static Map<Integer, SelectOperateEnum> typeMap = Arrays
            .stream(SelectOperateEnum.values())
            .collect(Collectors.toMap(SelectOperateEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static SelectOperateEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
